﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YiLong.Framework.Entity
{
    public class AjaxResult
    {
        public bool IsSuccess { get; set; }

        public string Code { get; set; }

        public string Message { get; set; }

        public object Data { get; set; }

        public static AjaxResult Success()
        {
            return Success("","",null);
        }

        public static AjaxResult Success(string message)
        {
            return Success("",message,null);
        }

        public static AjaxResult Success(string code, string message)
        {
            return Success(code, message, null);
        }

        public static AjaxResult Success(object data)
        {
            return Success("", "", data);
        }

        public static AjaxResult Success(string code,string message,object data)
        {
            return new AjaxResult
            {
                IsSuccess = true,
                Code= code,
                Message = message,
                Data = data
            };
        }

        public static AjaxResult Error(string code, string message, object data)
        {
            return new AjaxResult
            {
                IsSuccess = false,
                Code = code,
                Message = message,
                Data = data
            };
        }
    }
}
